﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using BLL;

namespace WeChat.Manager
{
    public partial class UserManager : System.Web.UI.Page
    {
        SubscribesBLL sb = new SubscribesBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ForLogin.IsLogin())
                {
                    
                }
                else
                {
                    Response.Redirect("../Login.aspx"); return;
                }
                selectedIndexChanged(sender,e);
            }
        }
        //根据分组查看关注用户
        protected void selectedIndexChanged(object sender, EventArgs e)
        {
            string groupid = grps.Text;
            if (groupid.Equals("全部"))
            {
                groupid = "1001";
            }
            DataSet ds = sb.getSubsUsers(Int32.Parse(groupid));
            Label1.Text = "用户数：" + ds.Tables[0].Rows.Count + "人";
            UserShow.DataSource = ds;
            UserShow.DataBind();
        }
        //根据用户名称查找关注用户
        protected void findByname(object sender, EventArgs e)
        {
            string name = username.Value;
            if (name != "")
            {
                DataSet ds = sb.getSubsUser(name);
                UserShow.DataSource = ds;
                UserShow.DataBind();
            }
            else
            {
                return;
            }
        }
    }
}
